//package proxy;
//
//import org.springframework.beans.BeansException;
//import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
//import org.springframework.beans.factory.support.BeanDefinitionBuilder;
//import org.springframework.beans.factory.support.BeanDefinitionRegistry;
//import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
//import org.springframework.beans.factory.support.GenericBeanDefinition;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;
//import org.springframework.core.annotation.AnnotationAttributes;
//import org.springframework.core.type.AnnotationMetadata;
//import org.springframework.stereotype.Component;
//
//@Component
//public class MyRegistryBean implements ApplicationContextAware, BeanDefinitionRegistryPostProcessor {
//
//    private ApplicationContext ctx;
//    @Override
//    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
//    }
//    public class MapperScannerRegistrar implements ImportBeanDefinitionRegistrar, ResourceLoaderAware {
//
//        @Override
//        public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
//
//            //获取mapperScan注解上对应的值
//            AnnotationAttributes annoAttrs = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(MapperScan.class.getName()));
//            //利用ClassPathMapperScanner进行扫描，扫描后通过BeanDefinitionRegistry进行注册
//            ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry);
//            //..省略其中部分代码   然后利用scanner进行扫描
//            scanner.doScan(StringUtils.toStringArray(basePackages));
//
//        }
//
//    }
//
//
//
//    @Override
//    public void setApplicationContext(ApplicationContext ctx) throws BeansException {
//        this.ctx = ctx;
//    }
//
//}
